package com.xx.happychatboot.base.vo.response;

import lombok.Data;

import java.util.List;

@Data
public class ResponseDate<T> {
    private Integer code;
    private String msg;
    private T data;
    private List<?> rows;

    public ResponseDate() {
    }

    public ResponseDate(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResponseDate(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseDate(Integer code, T data) {
        this.code = code;
        this.data = data;
    }

    public ResponseDate(Integer code, String msg, List<?> rows) {
        this.code = code;
        this.msg = msg;
        this.rows = rows;
    }

    public ResponseDate(Integer code, List<?> rows) {
        this.code = code;
        this.rows = rows;
    }

    public static <T> ResponseDate<T> success(String msg, T data) {
        return new ResponseDate(200, msg, data);
    }

    public static ResponseDate success(String msg, List<?> rows) {
        return new ResponseDate(200, msg, rows);
    }

    public static <T> ResponseDate<T> success(String msg) {
        return new ResponseDate(200, msg);
    }

    public static <T> ResponseDate<T> success(T data) {
        return new ResponseDate(200, data);
    }

    public static <T> ResponseDate<T> success(List<?> rows) {
        return new ResponseDate(200, rows);
    }

    public static <T> ResponseDate fail(String msg, T data) {
        return new ResponseDate(500, msg, data);
    }

    public static ResponseDate fail(String msg, List<?> rows) {
        return new ResponseDate(500, msg, rows);
    }

    public static <T> ResponseDate fail(String msg) {
        return new ResponseDate(500, msg);
    }
}
